package com.sinoeyes.platform.handle;

import com.sinoeyes.agreement.po.AgreementPo;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @program: PerformanceX
 * @description: 实现过程测试案例（思路草稿）
 * @author: aries.hao
 * @create: 2019/09/24 15:35
 */
public class HandlerTest {

    private static SimpleDateFormat simpleDateFormat = null;
    private static Object lock = new Object();

    private static void getInstance() {
        synchronized (lock) {
            if(simpleDateFormat == null) {
//                simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
                simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
            }
        }
    }

    public static void main(String[] args) {
        getInstance();
        AgreementPo agreement = new AgreementPo();
        agreement.setBeginDate(new Date());
        agreement.setEndDate(new Date());
        agreement.setUpdateTime(new Date());

//        SqlDateUtil.realConvertDate(agreement, simpleDateFormat, "strBeginTime", "begin");
//        SqlDateUtil.realConvertDate(agreement, simpleDateFormat, "strEndTime", "end");
//        SqlDateUtil.realConvertDate(agreement, simpleDateFormat, "strUpdateTime", "update");
        /**  上述工具类的hardcode实现 by haosc
         * Method[] methods = agreement.getClass().getMethods();
            for (Method method : methods) {
                if ("setStrBeginTime".equals(method.getName())) {
                    method.invoke(agreement, strBeginTime);
                    continue;
                }
                if ("setStrEndTime".equals(method.getName())) {
                    method.invoke(agreement, strEndTime);
                    continue;
                }
                if ("setStrUpdateTime".equals(method.getName())) {
                    method.invoke(agreement, strUpdateTime);
                }
       }**/


        System.out.println(agreement);
    }
}

